package com.bankcomm.common;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;

public class LPAlert {
    /** ISEXIT：是否退出应用。true:退出；false:不退出。 */
    public static boolean ISEXIT = true;
    /** isEnableSend_：是否提示提交错误报告。true:提示；false:不提示。 */
    private boolean isEnableSend_;
    String sendLogCmdName_ = "报告错误";
    private LPMid mid_;

    /**
     * Return this display in case the caller is a setCurrent() call embedded by netbeans.
     */
    void infoAlert(final Activity activity, LPMid mid, final String info, boolean isEnableSend) {
        mid_ = mid;
        final Builder ad = new AlertDialog.Builder(activity);
        if (isEnableSend) {
            //           
            // TODO Auto-generated method stub

            ad.setTitle("提示").setMessage(info).setCancelable(true).setPositiveButton(sendLogCmdName_,
                    new DialogInterface.OnClickListener() {

                        public void onClick(DialogInterface dialog, int which) {
                            // TODO Auto-generated method stub
                        }

                    }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface arg0, int arg1) {
                    // TODO Auto-generated method stub
                }
            });
        } else {
            final boolean isExit = ISEXIT;
            if (!ISEXIT)
                ISEXIT = true;

            // TODO Auto-generated method stub
            ad.setTitle("提示").setMessage(info).setCancelable(true).setNegativeButton("确定",
                    new DialogInterface.OnClickListener() {

                        public void onClick(DialogInterface dialog, int which) {
                            // TODO Auto-generated method stub

                        }

                    });
        }

        if (null != activity) {
            activity.runOnUiThread(new Runnable() {
                public void run() {
                    if (!activity.isFinishing()) {
                        ad.show();
                    }
                }

            });
        }
    }

}
